package com.dcliu.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.dcliu.bean.Customer;
import com.dcliu.db.Page;
import com.dcliu.db.PageRequest;
import com.dcliu.db.SQLDao;

public class CustomerService {

	@Autowired
	private SQLDao dao;
	
	public Customer getInfoByName(String uname){
		return (Customer)dao.selectOne("customer.getInfoByName", uname);
	}
	
	public List<Customer> getInfoByUserPhone(String uPhone){
		return dao.select("customer.getInfoByUserPhone",uPhone);
	}
	
	public void batchUpdateCustomer(List<Customer> customerList){
		dao.update("customer.batchUpdateCustomer", customerList);
	}
	
	public void batchInsertCustomer(List<Customer> customerList){
		dao.insert("customer.batchInsertCustomer", customerList);
	}
	
	public void batchDeleteCustomer(List<Long> idList){
		dao.delete("customer.batchDeleteCustomer", idList);
	}
	
	public Page<Customer> getCustomerOfPage(PageRequest param){
		return dao.selectPage("customer.getCustomerOfPage", param);
	}
}
